package com.ziiwee.reduce.describe.models;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ziiwee.reduce.describe.FieldDescribe;
import com.ziiwee.reduce.describe.FieldOption;
import com.ziiwee.reduce.describe.FieldRule;
import org.springframework.core.ResolvableType;

import java.util.List;

/**
 * @author ziiwee
 * @data 2020/8/12
 */
public class FieldDescribeModel implements FieldDescribe {

    private String name;
    @JsonSerialize(using = ResolvableTypeSerializer.class)
    private ResolvableType type;
    private String label;
    private String description;
    private Boolean nullable;
    private Boolean readable;
    private Boolean writeable;
    private List<FieldRule> rules;
    private List<FieldOption> options;

    public FieldDescribeModel(String name, ResolvableType type, String label, String description, Boolean nullable, Boolean readable, Boolean writeable, List<FieldRule> rules, List<FieldOption> options) {
        this.name = name;
        this.type = type;
        this.label = label;
        this.description = description;
        this.nullable = nullable;
        this.readable = readable;
        this.writeable = writeable;
        this.rules = rules;
        this.options = options;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public ResolvableType getType() {
        return type;
    }

    public void setType(ResolvableType type) {
        this.type = type;
    }

    @Override
    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public Boolean getNullable() {
        return nullable;
    }

    public void setNullable(Boolean nullable) {
        this.nullable = nullable;
    }

    @Override
    public Boolean getReadable() {
        return readable;
    }

    public void setReadable(Boolean readable) {
        this.readable = readable;
    }

    @Override
    public Boolean getWriteable() {
        return writeable;
    }

    public void setWriteable(Boolean writeable) {
        this.writeable = writeable;
    }

    @Override
    public List<FieldRule> getRules() {
        return rules;
    }

    public void setRules(List<FieldRule> rules) {
        this.rules = rules;
    }

    @Override
    public List<FieldOption> getOptions() {
        return options;
    }

    public void setOptions(List<FieldOption> options) {
        this.options = options;
    }
}
